home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Format CD 42
/
Amiga Format AFCD42 (Issue 126, Aug 1999).iso
/
-coverdisks-
/
126a
/
football
/
user
/
viewnextweeksschedule.rexx
< prev
next >
Wrap
OS/2 REXX Batch file
|
1999-05-22
|
5KB
|
168 lines
/* ***********************************************************************
VIEW NEXT WEEKS SCHEDULE PROGRAM FOR FOOTBALL REXX SUITE
----------------------------------------------------------
Copyright Mark Naughton 1997
Version Date History
--------------------------------------------------------------------------
1.0 071097 First release.
151297 Tidied display.
**************************************************************************
Procedure
---------
1. Check files exist. Read Teams.df datafile and store league name. Check
for autoscheduled.
2. If league has not been autoscheduled then give an error and quit.
3. Open AutoSchedule file and find the type.
4. Set range for the dates.
5. Display the header.
6. Open '.sf' file. Search for matches played during the next week...
7. If Weeks, if a match is found then display the formatted data. But
when a new week is found, goto (9).
8. If Dates, format the date from the line read from the file and if
it is within the two dates, format the data and display.
9. When the file is finished, print the number of matches and exit...
************************************************************************** */
PARSE ARG league_stuff
version = 1
input_file = '.df'
input2_file = '.sf'
title = '*LEAGUE_NAME='
autosched = '*AUTOSCHD='
separator = '*'
not_played = '__ __'
months = "January February March April May June July August September October November December"
parse var league_stuff league_file
league_file = "Data/" || league_file
if exists(league_file || input_file) = 0 then exit
if exists(league_file || input2_file) = 0 then exit
autos = 0
if open(datafile,league_file || input_file,'r') then do
do while ~eof(datafile)
line = readln(datafile)
if pos(title,line) > 0 then
league_title = delstr(line,1,13)
if pos(autosched,line) > 0 then do
autofile = delstr(line,1,10)
autos = 1
end
end
close(datafile)
end
else do
say
say "ERROR : (ViewNextWeeksSchedule)"
say
say "Cannot read '"league_file || input_file"' for league name."
exit
end
if autos = 0 then do
say
say "ERROR : (ViewNextWeeksSchedule)"
say
say "Cannot view schedules for next week."
say
say "This program will only show schedule files that have"
say "created from a schedule definition file such as "
say "'Teams6.schd'. Program aborted."
say
exit
end
type = 0
if autos = 1 then do
if open(datafile,"Data/"||autofile||".schd",'r') then do
line = readln(datafile)
if pos("*WEEKS",line) > 0 then
type = 10
if pos("*DATES",line) > 0 then
type = 20
close(datafile)
end
else do
say
say "ERROR : (ViewNextWeeksSchedule)"
say
say "Cannot read 'Data/"autofile".schd' to check what type of"
say "schedule it is."
exit
end
end
start_date = date('i')
end_date = start_date + 6
say
say center("Display Next Weeks Schedule for '"league_title"'",78)
say "-------------------------------------------------------------------------------"
say
say "Created from '"autofile"' schedule defintion file."
say
say
if type=10 then
say "Matches To Be Played Over the Next Week."
else
say "Matches To Be Played Between "date('n',start_date,'i')" and "date('n',end_date,'i')"."
say
matches = 0
if open(datafile,league_file || input2_file,'r') then do
do while ~eof(datafile)
line = readln(datafile)
if pos(separator,line) > 0 then do
if pos("*Week:",line) > 0 then do
curr = 10
if matches > 0 then
leave
end
if pos("*Date:",line) > 0 then do
curr = 0
year = word(line,5)
mnth = word(line,4)
day = word(line,3)
curd = trim(year)||right(find(months,mnth),2,0)||right(day,2,0)
if start_date <= date('i',curd,'s') & end_date >= date('i',curd,'s') then
curr = 10
end
end
if curr = 10 then do
if pos(separator,line) = 0 then do
if pos(not_played,line) > 0 then do
home_team = strip(substr(line,1,35))
away_team = strip(substr(line,41,35))
say left(home_team,30)" v "away_team
matches = matches + 1
end
end
end
end
close(datafile)
say
if matches = 0 then
say "No matches to be played."
else
say "Number of matches to be played: "matches
say
say "-------------------------------------------------------------------------------"
say
end
else do
say
say "ERROR : (ViewNextWeeksSchedule)"
say
say "Cannot read '"league_file || input2_file"' datafile."
end
exit